﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyBlog.Common
{
    /// <summary>
    /// 异步请求状态
    /// </summary>
    public enum AjaxState
    {
        /// <summary>
        /// 超时或session过期 值为0
        /// </summary>
        Timeout = 0,
        /// <summary>
        /// 成功 值为1
        /// </summary>
        Success = 1,
        /// <summary>
        /// 失败或异常 值为2
        /// </summary>
        Fail = 2,
        /// <summary>
        /// 需要跳转Url 值为3
        /// </summary>
        UrlRedirect = 3,
        /// <summary>
        /// 需要激活
        /// </summary>
        NeedActive = 4
    }


    /// <summary>
    /// 异步请求结果的Json对象
    /// </summary>
    public class JsonData
    {
        /// <summary>
        /// 响应的消息
        /// </summary>
        public string Message { set; get; }

        /// <summary>
        /// 异步请求状态
        /// </summary>
        public AjaxState State = AjaxState.Success;

        /// <summary>
        /// 返回的Url
        /// </summary>
        public string Url { set; get; }

        /// <summary>
        /// 返回的数据
        /// </summary>
        public object Data { set; get; }
    }
}


